/*
 *  Cero Project - Copyright   2006 The Cero Developement Team 
 *  (Michael Laguerre, Camille Roux, Matthieu Segret, Mathieu Sivade) 
 * 
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the Free 
 *  Software Foundation; either version 2 of the License, or (at your option) 
 *  any later version.
 * 
 *  This program is distributed in the hope that it will be useful, but 
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 *  for more details.
 */

package org.ceroproject.games;

/**
 * Even though it's empty, it'll help in determining whether a class is a rule
 * or not if we use dynamic loading
 * 
 * @author Telem
 */
public interface Rule {
	/*
	 * XXX : maybe we could add something like an "affects" function, which
	 * would return what cards/actions are affected by that Rule. Same would go
	 * with priority comparison, rules exclusiveness and such. It would be
	 * useful for configuring the game at user level. Also, we should know what
	 * game is affected by this rule => we need to define game IDs ! (random
	 * serials, Strings or based on the folder containing the class ?)
	 */

	/**
	 * Returns the name of the rule. Even though this looks boring, it will help
	 * the user in choosing the rules to play in a game, so name those carefully !
	 * 
	 * @return The user-friendly name of the rule
	 */
	String getRuleName();

	/**
	 * Same ideas as getName here : this description will be used as a reminder
	 * for the user.
	 * 
	 * @return a user-friendly yet short description of the rule.
	 */
	String getRuleDescription();

	/**
	 * You should tell this rule's constraints (minimum number of players, etc)
	 * here.
	 * 
	 * @return a user-friendly text explaining this rule's constraints upon the
	 *         game.
	 */
	String getRuleConstraints();

	/**
	 * Indicates whether this rule accepts the game's current settings (number
	 * of players, etc)
	 * 
	 * @param game
	 *            The game which settings are to be checked
	 * @return true if the game is accepted, false otherwise
	 * @throws ValidationException
	 *             if the rule doesn't validate this game
	 */
	void validateGame(Game game) throws ValidationException;

	/**
	 * Offers this rule the opportunity to initialize
	 * 
	 * @param game
	 *            the game this rule is used in
	 */
	void initializeRule(Game game) throws InitializationException;

	public String toString();
}
